<template>
    <div class="container">
        <p>点击次数number：{{count}}</p>
        <p>现在是{{oddOrEven}}</p>
        <button @click="handleAdd">加1步</button>
        <button @click="handleAdd2">加2步</button>
        <button @click="handleJian">减</button>
        <button @click="handleAddOdd">只有是偶数的时候才增加</button>
        <button @click="handleAddAsync">异步增加点击增加</button>
    </div>
</template>

<script>
    import {mapState,mapActions,mapGetters} from 'vuex'
    export default {
        name: "App",
        data () {
            return {}
        },
        computed:{
            // 起别名
            ...mapGetters({oddOrEven:'evebOrOdd'}),
            ...mapState(['count'])
            /*oddOrEven () {
                return this.$store.getters.evebOrOdd
            }*/
        },
        methods:{
            ...mapActions(['handleAdd','handleAdd2','handleJian','handleAddOdd','handleAddAsync'])
           /* handleAdd () {this.$store.dispatch('handleAdd')},
            handleAdd2 () {this.$store.dispatch('handleAdd',2)},
            handleJian () {this.$store.dispatch('handleJian')},
            handleAddOdd () {this.$store.dispatch('handleAddOdd')},
            handleAddAsync () {this.$store.dispatch('handleAddAsync')}*/
        }

    }
</script>

<style lang="stylus" scoped>
</style>